package com.myway.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class NameUtil {
	
	public static boolean isChinese(String name){
		Pattern pattern = Pattern.compile("^[\u4E00-\u9FA5]{1,10}[a-zA-Z]{0,4}$");
		Matcher matcher = pattern.matcher(name);
		return matcher.find();
	}
	
	public static int chineseNameLength(String name)
	{
		//最后一个汉字以后的字符都归为一个汉字
		return 0;		
	}
	public static boolean isEnglish(String name){
		//格式为“xx/xx xx”的英文名可以通过， “/”只能有一个，“空格”只能有一个或没有，“/”两边至少各有两个字符
		Pattern pattern = Pattern.compile("^[a-zA-Z]{2,}/[a-zA-Z]{2,}$");
		Matcher matcher = pattern.matcher(name);
		return matcher.find();
	}
	

}
